"           vim基本配置
set shortmess=atI                       " 快速启动
winpos 300 50                           " 设定窗口位置
set lines=32 columns=90                 " 设定窗口大小
set nocompatible                        " 关闭 vi 兼容模式
"set guifont=Consolas:h12:cANSI          " 设置用于GUI图形用户界面的字体列表
syntax on                               " 自动语法高亮
set syn=cpp                             " 设置语法高亮度
set nu!                                 " 查找结果高亮度显示
colorscheme my                          " 设定配色方案
set number                              " 显示行号
set cursorline                          " 突出显示当前行
set ruler                               " 打开状态栏标尺
set softtabstop=4                       " 使得按退格键时可以一次删掉 4 个空格
set tabstop=4                           " 设定 tab 长度为 4
set autochdir                           " 自动切换当前目录为当前文件所在的目录
set autoread                            " 自动加载
set autowriteall                        " 自动保存
set backupcopy=yes                      " 设置备份时的行为为覆盖
set history=100                         " 设置操作历史纪录
set ignorecase smartcase                " 搜索时忽略大小写，但在有一个或以上大写字母时仍保持对大小写敏感
set nowrapscan                          " 禁止在搜索到文件两端时重新搜索
set incsearch                           " 输入搜索内容时就显示搜索结果
set hlsearch                            " 搜索时高亮显示被找到的文本
set noerrorbells                        " 关闭错误信息响铃
set novisualbell                        " 关闭使用可视响铃代替呼叫
set t_vb=                               " 置空错误铃声的终端代码
set showmatch                           " 插入括号时，短暂地跳转到匹配的对应括号
set matchtime=2                         " 短暂跳转到匹配括号的时间
set magic                               " 设置魔术
set hidden                              " 允许在有未保存的修改时切换缓冲区，此时的修改由 vim 负责保存
set linebreak                           " 断行设置
set autoindent                          " 智能插入
set smartindent                         " 开启新行时使用智能自动缩进
set backspace=indent,eol,start          " 不设定在插入状态无法用退格键和 Delete 键删除回车符
set cmdheight=1                         " 设定命令行的行数为 1
set laststatus=2                        " 显示状态栏 (默认值为 1, 无法显示状态栏)
"set foldenable                          " 开启折叠
set foldmethod=syntax                   " 设置语法折叠
set foldcolumn=0                        " 设置折叠区域的宽度
setlocal foldlevel=5                    " 设置折叠层数为
set foldclose=all                       " 设置为自动关闭折叠
nnoremap <space> @=((foldclosed(line('.')) < 0) ? 'zc' : 'zo')<CR>
                                        " 用空格键来开关折叠
set comments=://                        " C/C++注释
set comments=s1:/*,mb:*,ex0:/           " 修正自动C式样注释功能 <2005/07/16>
                                        " _vimrc编辑后重载
se ai                                   " 自动缩进
filetype plugin indent on               " 开启插件
" 基本键盘映射
nmap ; :
imap jj <Esc>
" buffers操作快捷方式!
nnoremap <C-return> :bnext<cr>
nnoremap <C-S-return> :bprevious<cr>
" tab操作快捷方式!
nnoremap <C-tab> :tabnext<cr>
nnoremap <C-S-tab> :tabprev<cr>
"自动括号补全
inoremap ( ()<ESC>i
inoremap ) <c-r>=ClosePair(')')<CR>
inoremap { {}<ESC>i
inoremap } <c-r>=ClosePair('}')<CR>
inoremap [ []<ESC>i
inoremap ] <c-r>=ClosePair(']')<CR>
inoremap < <><ESC>i
inoremap " ""<ESC>i
inoremap ' ''<ESC>i
" 切换窗口快捷键
nnoremap <C-h> <C-w>h
nnoremap <C-j> <C-w>j
nnoremap <C-k> <C-w>k
nnoremap <C-l> <C-w>l
" 默认不显示菜单，工具栏 <F2>切换
if has("gui_running")
    set guioptions-=m
    set guioptions-=T
    map <silent> <F2> :if &guioptions =~# 'T' <Bar>
            \set guioptions-=T <Bar>
            \set guioptions-=m <bar>
        \else <Bar>
            \set guioptions+=T <Bar>
            \set guioptions+=m <Bar>
        \endif<CR>
endif

""""""""""""""""""""""""""""""""""""""""
"			scriptbundle设置
set runtimepath+=~/.vim/scripts/scriptbundle/
call scriptbundle#rc()  
" Set a vim.org reverse proxy server if vim.org can't get access.  
" let g:vimSiteReverseProxyServer = 'http://vim.wendal.net'

" Set http or socks proxy if vim.org can't get access.  
" let g:curlProxy = 'http://127.0.0.1:8888'  
" let g:curlProxy = 'socks5://127.0.0.1:8888'

" Some scripts require 7zip to extract.  
" let g:extractApp = 'path_to_7z_execute_file'

" mark - http://www.vim.org/scripts/script.php?script_id=2666  
Script '2666'  
" matchit - http://www.vim.org/scripts/script.php?script_id=39  
Script '39'
" align - http://www.vim.org/scripts/script.php?script_id=294  
Script '294'
" emmet
Script '2981'
" vim-airline
Script '4661'
" fugitive
Script '2975'
" nerdtree
Script '1658'
" winmanager
Script '1440'
" taglist
Script '273'
" neosnippet
Script '4459'
" xptemplate
Script '2611'

" Brief help  
" ScriptInstall     - Install configured and non-installed scripts  
" ScriptInstall!    - Reinstall all installed scripts  
" ScriptUpdate      - Update all installed scripts
" ScriptClean       - Uninstall all unneeded scripts

""""""""""""""""""""""""""""""""""""""""
"			插件设置
" vim-ariline
let g:airline_powerline_fonts = 1
let g:airline#extensions#tabline#enabled = 1
" nerdtree
nnoremap <F3>  :exe 'NERDTreeToggle'<CR>
" winmanager
:let loaded_winmanager = 1
nnoremap <F12> :WMToggle<CR>
